// Raf Lempens & Bjorn Schobben
#include "QtLaser.h"
#include "QtLaserActivateAnimation.h"

QtLaser::QtLaser(unsigned int initialCellX, unsigned int initialCellY): Laser(initialCellX, initialCellY), animationLog(0)
{
	laserSprite = new QtLaserSprite();
}

QtLaser::~QtLaser()
{
	if (laserSprite)
	{
		delete laserSprite;
		laserSprite = 0;
	}
}

void QtLaser::SetAnimationLog(QtAnimationLog* log)
{
	animationLog = log;
}

void QtLaser::SetTarget(GameObject* target)
{
	if(animationLog)
	{
		QtLaserActivateAnimation command;
		
		command.SetLaser(laserSprite, target->CellX(), target->CellY());

		animationLog->AddAnimationCommand(&command);
	}
}


QtLaserSprite* QtLaser::GetSprite() const
{
	return laserSprite;
}



